package com.hex.ds.hdrs.period.job.controller;

import com.hex.ds.hdrs.period.job.po.JobTaskLocation;
import com.hex.ds.hdrs.period.job.service.JobTaskLocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lwz
 * @date 2021-01-08
 * @des
 */

@Slf4j
@RestController
@Api(tags = "任务依赖坐标维护")
@RequestMapping("/api/jobTaskLocation")
public class JobTaskLocationController {

    @Autowired
    private JobTaskLocationService jobTaskLocationService;

    /**
     * 保存更新任务坐标
     *
     * @param list
     * @return
     */
    @PostMapping("/saveAndUpdate")
    @ApiOperation("保存更新任务坐标")
    public ResponseEntity<Object> saveAndUpdate(@RequestBody List<JobTaskLocation> list) {
        log.info("【JobTaskLocationController.saveAndUpdate】参数List<JobTaskLocation>: {}", list.toString());
        this.jobTaskLocationService.saveAndUpdate(list);
        return new ResponseEntity("新增成功", HttpStatus.OK);
    }
}
